import React, { useEffect, useState } from "react";
import { useLocation, Route } from "react-router-dom";
import Permissionsnav from "../../component/permissionsnav"; //导航栏
import Permissionsearch from "../../component/permissionsearch"; //搜索
import style from "../../style/permisscontent.module.scss";
import { renderRoutes } from "react-router-config";
const Rolemanage = (props) => {
  // console.log(props);
  const loacltion = useLocation();
  const route =
    loacltion.pathname.split("/")[loacltion.pathname.split("/").length - 1];
  const [routes, setroutes] = useState();
  useEffect(() => {
    setroutes(route);
    //eeeeeee
  }, [route]);
  return (
    <>
      <div className={style.Box}>
        <Route
          exact
          path="/permissions/rolemanage"
          component={() => {
            return (
              <>
                <Permissionsnav route={routes}></Permissionsnav>
                <Permissionsearch
                  value={"角色名称"}
                  text={"添加角色"}
                  route={"addrole"}
                  type={"rolemanage"}
                ></Permissionsearch>
              </>
            );
          }}
        />
        {renderRoutes(props.route.routes)}
      </div>
    </>
  );
};

export default Rolemanage;
